<template>
  <div>
    <el-table-column :show-overflow-tooltip="true" sortable="custom" label="状态" prop="itemStatus">
      <template slot-scope="scope">
        <el-tooltip v-if="scope.row.itemStatus === -6" :content="'BPMS驳回信息：'+scope.row.rejectMsg" effect="dark" placement="top-start">
          <i class="el-icon-info" />
        </el-tooltip>
        <el-tooltip v-if="scope.row.itemStatus === -10" :content="'MDA驳回信息：'+scope.row.rejectMsg" effect="dark" placement="top-start">
          <i class="el-icon-info" />
        </el-tooltip>
        <el-tooltip v-if="scope.row.itemStatus === -11" :content="'item file驳回信息：'+scope.row.rejectMsg" effect="dark" placement="top-start">
          <i class="el-icon-info" />
        </el-tooltip>
        <el-tooltip v-if="scope.row.itemStatus === -2" :content="'初审驳回信息：'+scope.row.rejectMsg" effect="dark" placement="top-start">
          <i v-if="scope.row.itemStatus === -2" class="el-icon-info" />
        </el-tooltip>
        <el-tooltip v-if="scope.row.itemStatus === 11 && getValue(scope.row,'cerFlag') === 0" content="供应商未上传资质文件" effect="dark" placement="top-start">
          <i class="el-icon-document-delete" style="font-size:18px" />
        </el-tooltip>
        <el-tooltip v-if="scope.row.itemStatus === 11 && getValue(scope.row,'cerFlag') === 1" content="供应商已上传资质文件" effect="dark" placement="top-start">
          <i class="el-icon-document-checked" style="font-size:18px" />
        </el-tooltip>
        <el-tooltip v-if="scope.row.reqNo && scope.row.fileName" :content="'BPMS流水号：' + scope.row.reqNo + '文件名：' + scope.row.fileName" effect="dark" placement="top-start">
          <i class="el-icon-connection" style="font-size:18px" />
        </el-tooltip>
        <!--<el-popover
          v-if="(scope.row.errorMsg && JSON.parse(scope.row.errorMsg).length > 0)"
          placement="bottom"
          title="校验信息"
          trigger="click"
        >
          <div style="width:500px;height:400px;overflow:auto;">
            <div v-for="(msg,index) in JSON.parse(scope.row.errorMsg)" :key="index" :index="index">
              <span>{{ (index + 1) + '.' + msg }}</span>
              <el-divider />
            </div>
          </div>
          <i slot="reference" class="el-icon-warning" />
        </el-popover>-->
        <validateMsg :item="parseItemInfo(scope.row)" :type="1" />
        <span v-if="scope.row.itemStatus === 0">供应商撤回</span>
        <span v-if="scope.row.itemStatus === 1">供应商上传待审</span>
        <span v-if="scope.row.itemStatus === 2">待数据校验</span>
        <span v-if="scope.row.itemStatus === -2" style="color:#fc1111">已驳回至供应商</span>
        <span v-if="scope.row.itemStatus === 3">数据校验中</span>
        <span v-if="scope.row.itemStatus === 4">数据校验成功</span>
        <span v-if="scope.row.itemStatus === -4" style="color:#fc1111">数据校验失败</span>
        <span v-if="scope.row.itemStatus === 5">Item File审核中</span>
        <span v-if="scope.row.itemStatus === 8">提交BPMS操作中</span>
        <span v-if="scope.row.itemStatus === 10">BPMS审核中</span>
        <span v-if="scope.row.itemStatus === 11">MDA/BPMS审核中</span>
        <span v-if="scope.row.itemStatus === 6">数据二次校验中</span>
        <span v-if="scope.row.itemStatus === 7">二次校验成功</span>
        <span v-if="scope.row.itemStatus === -6" style="color:#fc1111">BPMS审核驳回</span>
        <span v-if="scope.row.itemStatus === -10" style="color:#fc1111">MDA审核驳回</span>
        <span v-if="scope.row.itemStatus === -11" style="color:#fc1111">Item File审核驳回</span>
        <span v-if="scope.row.itemStatus === 100">已发送Item File</span>
        <span v-if="scope.row.itemStatus === 12">供应商处理中</span>
        <span v-if="scope.row.itemStatus === 14">采购新增</span>
        <span v-if="scope.row.itemStatus === -1">已作废</span>
        <span v-if="scope.row.itemStatus === 101">已同步商品号</span>
        <span v-if="scope.row.itemStatus === 102">自动化操作中</span>
        <span v-if="scope.row.itemStatus === -102" style="color:#fc1111">OIF自动化出号失败</span>
        <span v-if="scope.row.itemStatus === -103" style="color:#fc1111">HOST自动化rekey失败</span>
        <span v-if="scope.row.itemStatus === 15">待二次数据校验</span>
        <span v-if="scope.row.itemStatus === 16">新品委员会审核中</span>
        <span v-if="scope.row.itemStatus === 103">已出号</span>
        <span v-if="scope.row.itemStatus === 17">IF出号核查驳回</span>
        <span v-if="scope.row.itemStatus === 18">等待线上建品推进</span>
      </template>
    </el-table-column>
  </div>
</template>
<script>
import validateMsg from '@/views/part/validateMsg'

export default {
  components: { validateMsg },
  methods: {
    parseItemInfo(val) {
      if (val === undefined || val === null || val === '') {
        return {}
      }
      if (val.itemInfo === undefined || val.itemInfo === null || val.itemInfo === '') {
        return {}
      }
      return JSON.parse(val.itemInfo)
    },
    getValue(row, key) { // 获取信息
      if (row === undefined || row === null || key === undefined || key === null || key === '') {
        return ''
      }
      if (row.itemInfo === undefined || row.itemInfo === null) {
        return ''
      }
      var item = JSON.parse(row.itemInfo)
      if (item === null) {
        return ''
      }
      return item[key]
    }
  }
}
</script>

